import java.util.Scanner;
import java.util.Stack;

/**
 * Created by JiaJia on 2019/4/10 0010.
 */
public class Internship02 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()){
            String input=sc.nextLine();
            System.out.println(reverse(input));
        }
        sc.close();
    }

    private static String reverse(String str){
        StringBuilder sb=new StringBuilder();
        int n=str.length();
        char[] ch=str.toCharArray();
        for (int i = 0; i <n ; i++) {
            if((ch[i]>='a'&&ch[i]<='z')||(ch[i]>='A'&&ch[i]<='Z')){
                sb.append(ch[i]);
            }
            if(ch[i]>='0'&&ch[i]>='9'){
                int num=ch[i];
                int j=i;
                Stack<Character> stack=new Stack<>();
                int k=j;
                for ( k = j; k <str.length() ; k++) {
                    if(ch[k]=='('||ch[k]=='['||ch[k]=='{'){
                        stack.push(ch[k]);
                    }
                    if(ch[k]==')'||ch[k]==']'||ch[k]=='}'){
                        stack.pop();
                    }
                    if(stack.isEmpty()){
                        break;
                    }
                }

                String cstr=str.substring(j+1,k-j-1);
                for (int l = 0; l <num ; l++) {
                    sb.append(cstr);
                }
            }

        }

        return sb.reverse().toString();
    }
}